package com.lx.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @Description:
 * @author: xuaner
 * @date: 2021年09月13日 18:49
 */

    @Configuration
    @EnableSwagger2 //开启swagger2
    public class SwaggerConfig {
    //配置了swagger的docket的bean实例
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo());
    }

    //配置swagger信息 = apiInfo
    private ApiInfo apiInfo(){
        Contact contact = new Contact("赵敬轩，张晟睿","","2972194799@qq.com");
        return new ApiInfo(
                "梨小后台开发接口文档",
                "前后端对接",
                "1.0",
                "123",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList()
        );
    }

    }

